package com.geekydoo.commands;

import generated.TaskType;

import java.util.List;
import java.util.logging.Logger;

import com.geekydoo.GeekyDooException;
import com.geekydoo.InputOutputHandler;

/**
 * The purpose of this class is to support exiting the program.
 * 
 * @author Patrick Dutch
 */
public class ExitCommand implements Command {

	private static Logger logger = Logger.getLogger("geekydoo");

	// Messages printed by the exit command
	private static final String MSG_GOODBYE = "\nThanks for using GeekyDoo. Goodbye!";

	// The list of all task objects managed by the program
	private List<TaskType> taskList;

	public void execute(List<TaskType> tasks) throws GeekyDooException {
		taskList = tasks;

		InputOutputHandler.printToConsole(MSG_GOODBYE, false, false);
		logger.info("Program will exit now");
		System.exit(0);
	}

	public boolean isListModified() {
		return false;
	}

	public List<TaskType> getPreExecutionList() {
		return taskList;
	}

}
